//
//  SearchRoutePlanParamModel.m
//  o_amap
//
//  Created by Q神 on 2021/4/19.
//

#import "SearchRoutePlanParamModel.h"
#import "MJExtension.h"

@implementation SearchRoutePlanParamModel

+ (AMapDrivingRouteSearchRequest *)calculateDriveRoute:(NSString *)query {
    SearchRoutePlanParamModel *routePlanParamModel = [SearchRoutePlanParamModel mj_objectWithKeyValues:query];

    AMapDrivingRouteSearchRequest *navi = [[AMapDrivingRouteSearchRequest alloc] init];
    navi.requireExtension = YES;
    navi.strategy = routePlanParamModel.mode;
    /* 出发点. */
    navi.origin = [AMapGeoPoint locationWithLatitude:[routePlanParamModel.from.latitude doubleValue]
                                           longitude:[routePlanParamModel.from.longitude doubleValue]];
    /* 目的地. */
    navi.destination = [AMapGeoPoint locationWithLatitude:[routePlanParamModel.to.latitude doubleValue]
                                                longitude:[routePlanParamModel.to.latitude doubleValue]];
    return navi;
}

@end
